{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <div class="layui-btn-group">
            <a href="{:url('store/log/truncate')}" class="layui-btn layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 一键清空</a>
        </div>
    </div>
    
    <table id="tableList" lay-filter="tableList"></table>
    <!-- 权限列 -->
    <script type="text/html" id="username">
        {{d.user.name}}
    </script>
</div>
{/block}
{block name="js"}
<script>
    layui.use(['layer', 'form', 'table', 'util', 'dropdown'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;
        var dropdown = layui.dropdown;

        // 渲染回访表格
        var insTb = table.render({
            elem: '#tableList',
            url: "{:url('store/log/index_json')}",
            page: true,
            cellMinWidth: 100,
            limit:'15',
            limits:[15,30,50,100,200,500],
            cols: [[
                {type:'numbers',title:'#'},
                {align: 'left', sort: true, title: '姓名',templet:'#username',width:120},
                {field: 'ip', align: 'left', sort: true, title: 'IP地址',width:140},
                {field: 'create_time', align: 'left', sort: true, title: '操作时间',width:160},
                {field: 'remark', align: 'left', sort: true, title: '操作行为',minWidth:550}
            ]],
            parseData: function(res){ //res 即为原始返回的数据
                return {
                  "code": res.code, //解析接口状态
                  "msg": res.msg, //解析提示文本
                  "count": res.data.total, //解析数据长度
                  "data": res.data.data //解析数据列表
                };
            }
        });

    });

</script>
{/block}
